package com.zh.mediaservice.config;

import com.alipay.easysdk.kernel.Config;
import com.zh.mediacommon.properties.AliPayProperties;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.xmlbeans.impl.xb.xsdschema.Public;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@Slf4j
@Data
public class AliPayConfig {
    @Bean
    public Config config(AliPayProperties aliPayProperties){
        Config config = new Config();
        config.protocol = aliPayProperties.getProtocol();
        config.gatewayHost = aliPayProperties.getGatewayHost();
        config.signType = aliPayProperties.getSignType();
        config.appId = aliPayProperties.getAppId();
        config.merchantPrivateKey = aliPayProperties.getAppPrivateKey();
        config.alipayPublicKey = aliPayProperties.getAlipayPublicKey();
        config.encryptKey = "";
        config.notifyUrl= aliPayProperties.getNotifyUrl();
        log.info("支付宝配置{}",config);
        return config;
    }

}